import axios from 'axios'
import React, { Component } from 'react'

export class xiang extends Component {
    constructor(props) {
      super(props)
    
      this.state = {
         obj:{}
      }
    }
    componentDidMount(){
        console.log(this.props.match.params.id);
        axios.get('/obj',{
            params:{
                id:this.props.match.params.id
            }
        }).then(res=>{
            this.setState({
                obj:res.data
            })
        })
    }
  render() {
      const {obj}=this.state
    return (
      <div>
          <img src={obj.img} alt="" />
          <p> <span>{obj.da}回答</span>
                <span>{obj.du}阅读</span>
                <span>{obj.title}</span>
                <span>{obj.name}</span></p>
      </div>
    )
  }
}

export default xiang